package com.mysiteforme.admin.base;
import com.mysiteforme.admin.base.AuthRealm.ShiroUser;
import com.mysiteforme.admin.entity.User;
import com.mysiteforme.admin.service.quartz.QuartzTaskLogService;
import com.mysiteforme.admin.service.quartz.QuartzTaskService;
import com.mysiteforme.admin.service.scrap.BlogArticleService;
import com.mysiteforme.admin.service.scrap.BlogChannelService;
import com.mysiteforme.admin.service.scrap.ScrapService;
import com.mysiteforme.admin.service.scrap.StageService;
import com.mysiteforme.admin.service.system.DictService;
import com.mysiteforme.admin.service.system.LogService;
import com.mysiteforme.admin.service.system.MenuService;
import com.mysiteforme.admin.service.system.RescourceService;
import com.mysiteforme.admin.service.system.RoleService;
import com.mysiteforme.admin.service.system.SiteService;
import com.mysiteforme.admin.service.system.TableService;
import com.mysiteforme.admin.service.system.UploadInfoService;
import com.mysiteforme.admin.service.system.UserService;
import com.mysiteforme.admin.util.date.DateWeek;

import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;

public class BaseController {
	
	public User getCurrentUser() {
		ShiroUser shiroUser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
		if(shiroUser == null) {
			return null;
		}
		User loginUser = userService.selectById(shiroUser.getId());
		return loginUser;
	}

	@Autowired
	protected UserService userService;

	@Autowired
	protected MenuService menuService;

	@Autowired
	protected RoleService roleService;

	@Autowired
	protected DictService dictService;

	@Autowired
	protected RescourceService rescourceService;

	@Autowired
	protected TableService tableService;

	@Autowired
	protected SiteService siteService;

	@Autowired
	protected LogService logService;

	@Autowired
	protected BlogChannelService blogChannelService;
	
	@Autowired
   protected BlogArticleService blogArticleService;
   
	@Autowired
	protected QuartzTaskService quartzTaskService;

	@Autowired
	protected QuartzTaskLogService quartzTaskLogService;

	@Autowired
	protected UploadInfoService uploadInfoService;
	
    @Autowired
	protected ScrapService scrapService;
    
    @Autowired
	protected  StageService stageService;

	@Autowired
	protected DateWeek dateWeek;
}
